/**
 * Created by Administrator on 2015/6/12.
 */
var cheerio=require("cheerio");
var fs=require('fs');
var doAnalyse=function(){
   fs.readFile("./instance/test/proxyIp-nodeal.txt",'utf8',function(err,data){
       if(err) console.error(err);
       var $= cheerio.load(data);
       var result="";
       $('#ip_list tr').each(function(index,el){
           if($(el).attr('class')!==undefined){
               var tds=$(el).find('td');
               if($(tds[6]).text()==='HTTP'){
                   var  ip=$(tds[2]).text();
                   var  port=$(tds[3]).text();
                   ip=ip+":"+port;
                   result+=ip+"\n";
               }
           }
       });
       fs.writeFile('./instance/test/proxyIp-deal.txt',result,'utf8',function(err){
           if(err) console.error(err);
       });
   });
};
doAnalyse();